#include "multiply1.h"
/**
    ABCAB
   *    A
   ------
   DDDDDD
 */
int main() {
  static char mul_buf[10];
  static char result_buf[10];
  char A, B, C, D;
  int mul, result;
  for (A = '1'; A < '9'; A++) {
    for (B = '0'; B < '9'; B++) {
      if (A == B) {
        continue;
      }
      for (C = '0'; C < '9'; C++) {
        if (A == C || B == C) {
          continue;
        }
        for (D = '1'; D < '9'; D++) {
          if (A == D || B == D || C == D) {
            continue;
          }
          mul_buf[0] = A;
          mul_buf[1] = B;
          mul_buf[2] = C;
          mul_buf[3] = A;
          mul_buf[4] = B;
          mul_buf[5] = '\0';
          result_buf[0] = D;
          result_buf[1] = D;
          result_buf[2] = D;
          result_buf[3] = D;
          result_buf[4] = D;
          result_buf[5] = D;
          result_buf[6] = '\0';
          sscanf(mul_buf, "%i", &mul);
          sscanf(result_buf, "%i", &result);

          fprintf((mul * (A - '0') == result) ? stdout : stderr,
                  "    %c%c%c%c%c\n   *    %c\n   ------\n   %c%c%c%c%c%c\n", A,
                  B, C, A, B, A, D, D, D, D, D, D);
          // return 0;
        }
      }
    }
  }
  return 0;
}